package com.jwp.parser;

import org.htmlparser.Parser;
import org.htmlparser.filters.HasAttributeFilter;
import org.htmlparser.util.NodeList;


public class ParseTask implements Runnable{
	private String url = "";
	public static HasAttributeFilter ttf = new HasAttributeFilter("class",
	"title");
	Parser p = new Parser();
	public ParseTask(String url){
		this.url = url;
	}
	public void run() {
		try {
			p.setURL(url);
			NodeList info = p.extractAllNodesThatMatch(ttf);
			 int listS = info.size();
			 for(int i=0;i<listS;i++){
				String tt = info.elementAt(i).toPlainTextString();
				System.out.println(tt);
			 }
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}
}
